package com.yycx.module.bus.provider.handler.haiying.tasktodo.settle.pay;

import com.yycx.bpm.provider.common.FlowableHelp;
import com.yycx.common.base.entity.EntityMap;
import com.yycx.common.base.module.export.DictDataVo;
import com.yycx.common.base.module.export.ExportField;
import com.yycx.common.base.utils.FlymeUtils;
import com.yycx.common.mybatis.interceptor.ExportInterceptor;
import com.yycx.common.mybatis.interceptor.PageInterceptor;
import com.yycx.common.mybatis.model.PageParams;
import com.yycx.common.mybatis.query.CriteriaQuery;
import com.yycx.common.security.OpenHelper;
import com.yycx.module.bus.client.entity.BusDept;
import com.yycx.module.bus.client.entity.hy.BusHyorderInovice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 发票管理
 *
 * @author zyf
 */
@Component
public class HySettlePayTab4TaskTodoHandler implements PageInterceptor<BusHyorderInovice> , ExportInterceptor {


    @Autowired
    private FlowableHelp flowableHelp;

    @Override
    public void prepare(CriteriaQuery<BusHyorderInovice> cq, PageParams pageParams, EntityMap params) {
        Long companyId = OpenHelper.getCompanyId();
        cq.eq("companyId", companyId);
        cq.orderByDesc("createTime");
    }

    @Override
    public List<EntityMap> complete(CriteriaQuery<BusHyorderInovice> cq, List<EntityMap> result, EntityMap extra) {
        for (EntityMap entityMap : result) {

        }
        return result;
    }

    @Override
    public void initExcelExportEntity(ExportField exportField, List list) {
        Object key = exportField.getKey();
        if (key.equals("invoiceType")) {
            List<DictDataVo> dictDataVos = new ArrayList<>();
            DictDataVo dictDataVo = new DictDataVo();
            dictDataVo.setLabel("专票");
            dictDataVo.setValue(2);
            DictDataVo dictDataVo2 = new DictDataVo();
            dictDataVo2.setLabel("普票");
            dictDataVo2.setValue(1);
            dictDataVos.add(dictDataVo);
            dictDataVos.add(dictDataVo2);
            exportField.setDictData(dictDataVos);
            exportField.setReplace();
        }
    }

}
